(function(){

	// what's the skin ?
	//
	var sk = svejo_skin  || '';

	// button dimensions depending on the skin
	//
	var h;
	var w;
	switch(sk) {

		case 'compact' :
			h=25;
			w=100;
			break;

		default :
			h=65;
			w=55
			break;
		}
	
	// what's the url ?
	//
	var url = svejo_url || window.location.href;

	// where did it originated ?
	//
	var friend = encodeURI(window.location.href);

	// read and sanitize the title
	//
	svejo_title = encodeURI(svejo_title || document.title);

	// read and sanitize the summary
	//
	svejo_summary = encodeURI(svejo_summary || '');

	// place the button
	//
	document.write("<iframe src='http://svejo.net/tools/button?url="
			+ encodeURI(url)

		// put the formatting parameters in the front ...
		//
		+ (typeof svejo_theme=='string'
			?("&amp;theme="+svejo_theme):'')
		+ (typeof svejo_bgcolor=='string'
			?("&amp;bgcolor="+svejo_bgcolor):'')
		+ (sk
			?("&amp;svejo_skin="+sk):'')

		// ... and put all the lengthy parameters after that
		//
		+ (typeof svejo_title=='string'
			?("&amp;title="+svejo_title):'')
		+ (typeof svejo_summary=='string'
			?("&amp;summary="+svejo_summary):'')
		+ (typeof svejo_topic_id=='string'
			?("&amp;topic_id="+svejo_topic_id):'')
		+ (typeof site_charset=='string'
			?("&amp;charset="+site_charset):'')
		+ "&amp;friend="
			+ friend

		// iframe formating
		//
		+ "' height='"
			+ h
		+ "' width='"
			+ w
		+ "' frameborder='0' scrolling='no'></iframe>");
})()
